package com.example.day2;

import static android.content.ContentValues.TAG;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.example.day2.mvvm.utils.DBUtils;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;
import com.hyphenate.easeui.EaseIM;
import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveBaseListener;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

public class App extends Application {
    private static Context context;
    @Override
    public void onCreate() {
        super.onCreate();
        //初始化数据库
        DBUtils.getInstance().init(this);
        context = this;
        //友盟分享 66f6531e80464b33f6d0dacd
        UMConfigure.init(this, "66f6531e80464b33f6d0dacd", "umeng", UMConfigure.DEVICE_TYPE_PHONE, "");
        PlatformConfig.setQQZone("101830139","5d63ae8858f1caab67715ccd6c18d7a5");
        String licenceURL = "https://license.vod2.myqcloud.com/license/v2/1330986992_1/v_cube.license"; // 获取到的 licence url
        String licenceKey = "484489dcfaf7015810863066db455fd5"; // 获取到的 licence key
        TXLiveBase.getInstance().setLicence(this, licenceURL, licenceKey);
        TXLiveBase.setListener(new TXLiveBaseListener() {
            @Override
            public void onLicenceLoaded(int result, String reason) {
                Log.i(TAG, "onLicenceLoaded: result:" + result + ", reason:" + reason);
            }
        });
        EMOptions options = new EMOptions();
        options.setAppKey("1144240925149630#2208a-cuizhibiao");

        //EaseIM 初始化
        if(EaseIM.getInstance().init(context, options)){
            //在做打包混淆时，关闭 debug 模式，避免消耗不必要的资源
            EMClient.getInstance().setDebugMode(true);
            //EaseIM 初始化成功之后再调用注册消息监听的代码 ...
        }



    }
    public static Context getContext(){
        return context;
    }
}
